package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.ProgressBean;
import com.project.bean.ProjectBean;
import com.project.mapper.IProjectMapper;
import com.project.service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProjectServiceImpl implements IProjectService {
    @Autowired
    private IProjectMapper mapper;

    @Override
    public void add(ProjectBean proj) {

        mapper.add(proj);
    }

    @Override
    public PageInfo<ProjectBean> findByItem(int pageNo, String name, String state, String orderBy) {

        PageHelper.startPage(pageNo,4);
        return PageInfo.of(mapper.findByItem(name,state,orderBy));
    }

    @Override
    public ProjectBean findById(Integer id) {
        return mapper.findById(id);
    }

    @Override
    public List<ProjectBean> findByState() {
        return mapper.findNotFinlish();
    }
}
